Only decrement internal waypt_ct if waypt_head is flushed.
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 5 Dec 2005 13:26:32 +0000 (13:26 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 5 Dec 2005 13:26:32 +0000 (13:26 +0000)
gpsbabel/waypt.c

index bf1af9880417ae3bebf12abe228891ed422099ec..ddd66e0140c99cb5551a5746781759f262fe97e2 100644 (file)
@@ -325,7 +325,9 @@ waypt_flush( queue *head )
        QUEUE_FOR_EACH(head, elem, tmp) {
                waypoint *q = (waypoint *) dequeue(elem);
                waypt_free(q);
-               waypt_ct--;
+               if (head == &waypt_head) {
+                       waypt_ct--;
+               }
        }
 }